# Python 2.6.4
# Project Euler, Problem 125
# Copyright 2010 Talha Zaman

pals = set()
for i in range(1, 10000):
    num = i**2
    for j in range(i+1, 10000):
        num += j**2
        if num>=10**8: break
        if str(num)==str(num)[::-1]: pals.add(num)
print sum(pals), len(pals)
